package com.product.id;

import org.apache.shardingsphere.spi.keygen.ShardingKeyGenerator;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Properties;

/**
 * @author Hanhuiyong
 * @version 1.0.0
 * @ClassName ItemIdShardingKeyGenerator.java
 * @Description
 * @createTime 2021年09月13日 13:39:00
 */
@Component
public class ItemIdShardingKeyGenerator implements ShardingKeyGenerator {

    @Resource
    private IdService idService;

    @Override
    public Comparable<?> generateKey() {
        return idService.getNextIemId();
    }

    @Override
    public String getType() {
        return "ITEMKEY";
    }

    @Override
    public Properties getProperties() {
        return null;
    }

    @Override
    public void setProperties(Properties properties) {

    }
}
